//
//  SecondHeadView.m
//  项目A --半糖
//
//  Created by romana on 16/5/19.
//  Copyright © 2016年 romana. All rights reserved.
//

#import "SecondHeadView.h"
#import "UIImageView+WebCache.h"

static CGFloat const textViewH = 0;
static CGFloat const gapViewH1 = 10;


@interface SecondHeadView ()

@property(nonatomic,strong)UICollectionView *myCollection1;

@end

@implementation SecondHeadView

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self doIt];
    }
    
    return self;
}


-(void)doIt{
 
    //标题view
    UIView *mytextView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, textViewH)];
    mytextView.backgroundColor = [UIColor whiteColor];
    [self addSubview:mytextView];
    //view中左侧图标
    UIImageView *smallImageV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 30)];
    smallImageV.backgroundColor = [UIColor yellowColor];
    [mytextView addSubview:smallImageV];
    
    //view中label
    UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 10, 300, 30)];
    textLabel.text = @"全部原创文章";
    textLabel.textAlignment = NSTextAlignmentLeft;
    textLabel.font = [UIFont systemFontOfSize:15];
    [mytextView addSubview:textLabel];
    
    //间隔灰色view
    UIView *gapView1 = [[UIView alloc] initWithFrame:CGRectMake(0, textViewH, self.frame.size.width, gapViewH1)];
    gapView1.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:gapView1];
    
    
    //分类view
    UIView *classView = [[UIView alloc] initWithFrame:CGRectMake(0, textViewH + gapViewH1, self.frame.size.width, 50)];
    classView.backgroundColor = [UIColor whiteColor];
    [self addSubview:classView];
    
    //class中图标
    UIImageView *classImageV = [[UIImageView alloc] initWithFrame:CGRectMake(10, textViewH + gapViewH1 + 15, 20, 20)];
    classImageV.image = [UIImage imageNamed:@"class"];
    classImageV.backgroundColor = [UIColor whiteColor];
    [self addSubview:classImageV];
    
    //class中label
    UILabel *classLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, textViewH + gapViewH1 + 10, 300, 30)];
    classLabel.text = @"分类";
    classLabel.textAlignment = NSTextAlignmentLeft;
    classLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:classLabel];
    
    
    //scrollView
    textView *myTView = [[textView alloc]initWithFrame:CGRectMake(0, textViewH * 2 + gapViewH1 + 50, 414, 320)];
    myTView.backgroundColor = [UIColor whiteColor];
    [self addSubview:myTView];
    
    // 间隔灰色view2
    UIView *gapView2 = [[UIView alloc] initWithFrame:CGRectMake(0, textViewH * 2 + gapViewH1 + 320 + 50, self.frame.size.width, gapViewH1)];
    gapView2.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:gapView2];
    
    

}


@end
